<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// See detail in http://wkb.ug/3429
test(() => {
    assert_not_equals(window.testRunner, undefined,
        'This test requires testRunner to read/write clipboard.');
    assert_selection(
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">^foo|</span>',
                '<span id="target">bar</span>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            let target = selection.document.getElementById('target');
            selection.collapse(target, 1);
            selection.document.execCommand('pasteAndMatchStyle');
        },
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">foo</span>',
                '<span id="target">barFoo|</span>',
            '</div>',
        ].join(''));
    }, 'text-transform should affect text in clipboard');
</script>
